home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Over 1,000 Windows 95 Programs
/
Over 1000 Windows 95 Programs (Microforum) (Disc 1).iso
/
1473
/
form1.frm
< prev
next >
Wrap
Text File
|
1997-03-06
|
10KB
|
348 lines
VERSION 4.00
Begin VB.Form Form1
Caption = "AD7896 Setup"
ClientHeight = 4200
ClientLeft = 1992
ClientTop = 3048
ClientWidth = 4704
Height = 4524
Icon = "Form1.frx":0000
Left = 1944
LinkTopic = "Form1"
ScaleHeight = 4200
ScaleWidth = 4704
Top = 2772
Width = 4800
Begin VB.CommandButton Command1
Caption = "E&xit"
Height = 375
Left = 3600
TabIndex = 18
Top = 2040
Width = 855
End
Begin VB.TextBox Text1
Alignment = 2 'Center
BackColor = &H00FF0000&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 400
size = 9.6
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 615
Left = 600
MultiLine = -1 'True
TabIndex = 17
Text = "Form1.frx":0442
Top = 3480
Width = 3855
End
Begin VB.CommandButton Start
Caption = "&Start"
Height = 375
Left = 3600
TabIndex = 8
Top = 2760
Width = 855
End
Begin VB.TextBox Interval
BackColor = &H00C00000&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 2640
TabIndex = 7
Text = "1000"
Top = 2160
Width = 615
End
Begin VB.TextBox DataReadBit
BackColor = &H00C00000&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 285
Left = 2640
TabIndex = 6
Text = "0"
Top = 1800
Width = 255
End
Begin VB.PictureBox Picture1
Height = 612
Left = 120
Picture = "Form1.frx":0482
ScaleHeight = 564
ScaleWidth = 564
TabIndex = 0
Top = 120
Width = 612
End
Begin VB.TextBox ConvertBit
BackColor = &H00C00000&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 285
Left = 2640
TabIndex = 5
Text = "0"
Top = 1440
Width = 255
End
Begin VB.TextBox ClockBit
BackColor = &H00C00000&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 285
Left = 2640
TabIndex = 4
Text = "0"
Top = 1080
Width = 255
End
Begin VB.TextBox PortReadAddress
BackColor = &H00C00000&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 285
Left = 2640
TabIndex = 3
Text = "889"
Top = 720
Width = 615
End
Begin VB.TextBox PortWriteAddress
Alignment = 2 'Center
BackColor = &H00C00000&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 285
Left = 2640
TabIndex = 2
Text = "888"
Top = 360
Width = 615
End
Begin VB.TextBox Analogue
BackColor = &H00C00000&
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 2640
TabIndex = 9
Top = 2760
Width = 615
End
Begin VB.Label Label7
Caption = "Interval Timer"
Height = 252
Left = 1200
TabIndex = 16
Top = 2160
Width = 1212
End
Begin VB.Label Label6
Caption = "Analogue Value"
Height = 252
Left = 1200
TabIndex = 15
Top = 2880
Width = 1212
End
Begin VB.Label Label5
Caption = "Data Read Bit"
Height = 252
Left = 1200
TabIndex = 14
Top = 1800
Width = 1332
End
Begin VB.Label Label4
Caption = "Convert Bit"
Height = 252
Left = 1200
TabIndex = 13
Top = 1440
Width = 1332
End
Begin VB.Label Label3
Caption = "Clock Bit"
Height = 252
Left = 1200
TabIndex = 12
Top = 1080
Width = 1332
End
Begin VB.Label Label2
Caption = "Port Read Address"
Height = 252
Left = 1200
TabIndex = 11
Top = 720
Width = 1572
End
Begin VB.Label Label1
Caption = "Port Write Address"
Height = 252
Left = 1200
TabIndex = 10
Top = 360
Width = 1572
End
Begin AD7896Lib.AD7896 AD7896
Height = 600
Left = 120
TabIndex = 1
Top = 2160
Width = 600
_Version = 65536
_ExtentX = 1058
_ExtentY = 1058
_StockProps = 0
ClockBit = 8
ConvertBit = 4
DataReadBit = 7
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub AD7896_Timer()
Dim Data
Data = AD7896.Read
' The constant is used to convert the 12 bit data to a voltage.
' The constant is based on the supply/reference voltage of 5v (5v/4096)
Analogue.Text = Format$((Data * 0.001221001221001), "#0.00")
End Sub
Private Sub Analogue_Change()
End Sub
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
Show
AD7896.EnableTimer = False
End Sub
Private Sub Text2_Change()
End Sub
Private Sub Start_Click()
Static Toggle%
Toggle% = Toggle% Xor 1
If Toggle% = 1 Then
' read the various port and bit settings into the control
AD7896.ReadPortAddress = PortReadAddress.Text
AD7896.WritePortAddress = PortWriteAddress.Text
AD7896.ClockBit = ClockBit.Text
AD7896.ConvertBit = ConvertBit.Text
AD7896.DataReadBit = DataReadBit.Text
AD7896.Interval = Interval.Text
AD7896.EnableTimer = True
' disable the port and bit selectors during reading
PortReadAddress.Enabled = False
PortWriteAddress.Enabled = False
ClockBit.Enabled = False
ConvertBit.Enabled = False
DataReadBit.Enabled = False
Interval.Enabled = False
Start.Caption = "&Stop"
Else
' enable the port and bit settings
AD7896.EnableTimer = False
PortReadAddress.Enabled = True
PortWriteAddress.Enabled = True
ClockBit.Enabled = True
ConvertBit.Enabled = True
DataReadBit.Enabled = True
Interval.Enabled = True
Start.Caption = "&Start"
Analogue.Text = ""
End If
End Sub